home *** CD-ROM | disk | FTP | other *** search
- /*****************************************************************************/
- /* (C) 1993,1994 R. NADE - M. GRANDCHAMP - All Rights Reserved */
- /*****************************************************************************/
- /* This source-code is NOT public domain nor Freeware, this is part of */
- /* 'The C Programming Package' which is Shareware. */
- /* If you use this code, please register and get a free Full-VGA version */
- /*****************************************************************************/
- /*----------------*
- * CPPLINIT.C *
- * Text Version *
- * Initialisation *
- *----------------*/
-
- /* Included Files */
- # include <stdio.h>
- # include <io.h>
- # include <fcntl.h>
- # include <SYS\stat.h>
- # include <dir.h>
- # include <string.h>
-
- /* Global Variables */
- extern int x,y,z,i,j,k,l,m,n,printer,number,videocard,nbdisk,returning;
- extern int colour1,colour2,colour3,colour4,colour5;
- extern int pfserv,pfhelp,pfdiv;
- extern long dep,dephelp;
- extern unsigned char trashcan[],trashhelp[],trashelhelp[];
- extern unsigned char path[],record[],work[];
-
-
- /*----------------------*
- * READ HARDWARE CONFIG *
- *----------------------*/
- int read_hardware_config()
- {
- /* Read the numbers of drives (hard or floppy) */
- i=biosequip();
- if(i & 64){
- /* At least 3 drives */
- nbdisk=3;
- if(i & 128){
- /* 4 drives */
- nbdisk=4;
- }
- }
- /* Open the service file to get the current colours and to save */
- /* them if required */
- returning=open_working_file();
- if(returning==0) return(0);
- dep=lseek(pfserv,0L,SEEK_SET)+4;
- /*++++++++++++++ Colours ++++++++++++++ */
- lseek(pfserv,dep,0); read(pfserv,trashcan,3);
- trashcan[3]=0x00; number=atoi(trashcan);
- if(number>0) colour1=number;
- dep+=3;
- lseek(pfserv,dep,0); read(pfserv,trashcan,3);
- trashcan[3]=0x00; number=atoi(trashcan);
- if(number>0) colour2=number;
- dep+=3;
- lseek(pfserv,dep,0); read(pfserv,trashcan,3);
- trashcan[3]=0x00; number=atoi(trashcan);
- if(number>0) colour3=number;
- dep+=3;
- lseek(pfserv,dep,0); read(pfserv,trashcan,3);
- trashcan[3]=0x00; number=atoi(trashcan);
- if(number>0) colour4=number;
- dep+=3;
- lseek(pfserv,dep,0); read(pfserv,trashcan,3);
- trashcan[3]=0x00; number=atoi(trashcan);
- if(number>0) colour5=number;
- dep+=18;
- /*++++++++++++++ printer type ++++++++++++++*/
- lseek(pfserv,dep,0); read(pfserv,trashcan,3);
- trashcan[3]=0x00; printer=atoi(trashcan);
- /*++++++++ Get the videocard type choosen +++++++++++*/
- /* by the user and this is not necessary the best one */
- dep+=3;
- lseek(pfserv,dep,0); read(pfserv,trashcan,3);
- trashcan[3]=0x00; videocard=atoi(trashcan);
- /*+++++++++++ Get the choosen path to the +++++++++++++++*/
- /* data files, as choosen by the user */
- dep+=3;
- lseek(pfserv,dep,0); read(pfserv,path,64);
- path[64]=0x00;
- /* Check it to see if it is the directory where we are */
- /* if not, we ask to change it */
- getcwd(trashcan,80); trashcan[64]=0x00;
- j=strcmpi(path,trashcan);
- if(j!=0){
- k=message(" Current directory"," different of"," the saved one"," Modify ?"," Y/N ?");
- if(k==34){
- /* Answer = YES we copy the new path as the active one */
- strcpy(path,trashcan);
- lseek(pfserv,dep,0); write(pfserv,path,64);
- }
- }
- /*++++++ Recording path ++++*/
- dep+=64;
- lseek(pfserv,dep,0); read(pfserv,record,64);
- record[64]=0x00;
- /*++++++ Working path ++++*/
- dep+=64;
- lseek(pfserv,dep,0); read(pfserv,work,64);
- work[64]=0x00;
- /* We check it to see if it is the directory where we are */
- /* if not we ask to change it */
- getcwd(trashcan,80); trashcan[64]=0x00;
- j=strcmpi(work,trashcan);
- if(j!=0){
- k=message(" Current work"," directory"," different of"," the saved one"," Modify ? Y/N");
- if(k==34){
- /* Answer = YES we copy the new path as the active one */
- strcpy(work,trashcan);
- lseek(pfserv,dep,0); write(pfserv,work,64);
- }
- }
- /*++++++++++++++ close the file ++++++++++++++*/
- if(pfserv>-1) close(pfserv);
- pfserv=-1; return(1);
- }
- /*--------------*
- * INIT COLOURS *
- *--------------*/
- void init_colour()
- {
- /* VideoCard detection : colour or monochrome */
- /* ATTENTION if the card is a colour one and the monitor is monochrome */
- /* You need to change yourself the program : we detect the card */
- k=biosequip();
- /* If the service file was erased we init the colours */
- if((k & 48)==32){
- /* Mode 80x25 colour (videocard) */
- colour1=30; /* 14+1*16 = Yellow over Blue */
- colour2=112; /* 0+7*16 = Black over Lightgrey*/
- colour3=15; /* 15+0*16 = White over Black */
- colour4=32; /* 0+2*16 = Black over Green */
- colour5=78; /* 14+4*16 = Yellow over Red */
- }
- else{
- colour1=112; colour2=15; colour3=15;
- colour4=15; colour5=143;
- }
- }
- /* End of supplement of main program */
-